package org.feiye.studyday25.review;

import java.io.*;

public class BufferedReaderTest {
	// BufferedReader读文件
	public static void main(String[] args) {
		InputStream i = null;
		Reader r = null;
		BufferedReader b = null;
		try {
			i = new FileInputStream("F:\\叶飞io测试\\1.Java语言基础\\java_homework\\第二章\\java-basic-2-作业.txt");
			r = new InputStreamReader(i, "gbk");
			b = new BufferedReader(r);
			String len;
			while ((len = b.readLine()) != null) {
				System.out.println(len);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (b != null)
				try {
					b.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			if (r != null)
				try {
					r.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			if (i != null)
				try {
					i.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
		}
	}

}
